﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Configuration;
using System.Data;
using System.Data.SqlClient;

using Model.TrainModelHelper;



namespace DAL.TrainDALhelp
{
    public class TrainTypeDAL
    {
        private static string ConStr = ConfigurationManager.ConnectionStrings["ConStr"].ToString();
        private static SqlConnection conn = new SqlConnection(ConStr);
        public List<TrainTypeModel> TrainTypeDropList()
        {
            conn.Open();
            SqlCommand comd = new SqlCommand("select * from TrainTypeTable", conn);
            SqlDataReader read = comd.ExecuteReader();
            List<TrainTypeModel> lis = new List<TrainTypeModel>();
            while (read.Read())
            {
                TrainTypeModel str = new TrainTypeModel();

                str.TrainType_Id = Convert.ToInt32(read["TrainType_Id"]);
                str.TrainType_Name = read["TrainType_Name"].ToString();


                lis.Add(str);
                
                
            }
            read.Close();
            conn.Close();
            return lis;

        }
    }
}
